import subprocess

def ping_host(ip_address):
    try:
        # 构造 ping 命令
        # Windows 系统
        command = ["ping", "-n", "1", "-w", "1000", ip_address]
        # Linux/Unix 系统
        # command = ["ping", "-c", "1", "-W", "1", ip_address]

        # 执行命令
        output = subprocess.check_output(
            command,
            stderr=subprocess.STDOUT,
            universal_newlines=True
        )
        print(f"成功 ping 通 {ip_address}")
        print(output)
    except subprocess.CalledProcessError as e:
        print(f"无法 ping 通 {ip_address}")
        print(e.output)

# 示例：ping 内网中的设备
ping_host("10.244.255.9")